package com.briup.recognition.service.impl;

import com.briup.recognition.bean.CallLog;
import com.briup.recognition.bean.CallLogExample;
import com.briup.recognition.dao.CallLogMapper;
import com.briup.recognition.service.ICallLogService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CallLogServiceImpl implements ICallLogService {

    @Resource
    private CallLogMapper callLogMapper;

    @Override
    public List<CallLog> query(){
        CallLogExample example = new CallLogExample();
        return callLogMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(CallLog callLog){
        if (callLog.getId()!=null){
            callLogMapper.updateByPrimaryKey(callLog);
        }else{
            callLogMapper.insert(callLog);
        }
    }

    @Override
    public void deleteById(long id){
        callLogMapper.deleteByPrimaryKey(id);
    }

}
